import requests

from api.tpshop_api import TpshopLoginApi
from common.assert_tpshop_api import common_assert


class TestTpshopLoginApi:
    session = None

    def setup(self):
        self.session = requests.Session()
        TpshopLoginApi.verify_api(self.session)
        # response = TpshopLoginApi.verify_api(self.session)
        # assert 200 == response.status_code
        # assert "image" in response.headers.get("Content-Type")

    def test_login(self):
        login_data = {"username": "13800138006", "password": "123456", "verify_code": "8888"}
        resp = TpshopLoginApi.login_api(self.session, login_data)
        print("登录成功:", resp.json())

        common_assert(resp, 200, 1, "登陆成功")
        # common_assert(resp, 200, -1, "账号不存在")
        # common_assert(resp, 200, -2, "密码错误")
